AMPLIFY SDK
The AMPLIFY SDK for Node.js is a set of APIs for authenticating, switching selected organization,
creating MBS apps and users, and Titanium SDK support.
Installation
npm i @axway/amplify-sdk --save
Usage
import AmplifySDK from '@axway/amplify-sdk';
const sdk = new AmplifySDK({ ...opts });
Auth
const accounts = await sdk.auth.list();
let account = await.sdk.auth.find('foo');
account = await sdk.auth.login();
console.log(account.org);
console.log(account.user);
await sdk.auth.switchOrg(account, orgId);
console.log(`Active org is now ${account.org.name}`);
await sdk.auth.logout({ accounts: [ account ] });
const info = await sdk.auth.serverInfo();
console.log(info);
MBS (formerly ACS)
const apps = await sdk.mbs.createApps(account, '<GUID>', '<NAME>');
const user = await sdk.mbs.createUser(account, '<GROUP ID>', '<ENVIRONMENT>', {
admin: undefined,
custom_fields: undefined,
email: 'user@domain.com',
first_name: '',
last_name: '',
password: '',
password_confirmation: '',
photo_id: undefined,
role: undefined,
tags: undefined,
username: undefined
});
const users = await sdk.mbs.getUsers(account, '<GROUP ID>', '<ENVIRONMENT>');
Orgs
const envs = await sdk.org.getEnvironments(account);
console.log(envs);
Titanium
await sdk.ti.buildUpdate(account, {
buildId: 123,
buildSHA: '<SHA>',
keys: {
'file1': 'key1',
'file2': 'key2'
}
});
await sdk.ti.buildVerify(account, {
appGuid: '<GUID>',
appId: '<ID>',
deployType: 'production',
fingerprint: '<FINGERPRINT>',
ipAddress: '<IPADDRESS>',
modules: [],
tiapp: '<ti:app><name/><id/><guid/></ti:app>'
});
await sdk.ti.enroll(account, {
description: '<CERTIFICATE DESCRIPTION>',
fingerprint: '<FINGERPRINT>',
publicKey: '<PUBLIC KEY>'
});
const { url, api_token, limit } = await sdk.ti.getUploadURL(account, '<APP GUID>');
const info = await sdk.ti.getApp(account, '<APP GUID>');
const url = sdk.ti.getAppVerifyURL();
const downloads = await sdk.ti.getDownloads(account);
await sdk.ti.setApp(account, '<ti:app><name/><id/><guid/></ti:app>');
Account Object
The AMPLIFY SDK relies on the AMPLIFY Auth SDK for authenticating and managing access tokens.
For organization related information, it talks directly to the Axway platform.
account: {
auth {
authenticator: 'PKCE',
baseUrl: 'https://login.axway.com',
clientId: 'amplify-cli',
env: {
name: 'prod',
baseUrl: 'https://login.axway.com',
redirectLoginSuccess: 'https://platform.axway.com/'
},
expires: { access: 1587685009628, refresh: 1587700615628 },
realm: 'Broker',
tokens: {
access_token: '<SNIP>',
expires_in: 1800,
refresh_expires_in: 17406,
refresh_token: '<SNIP>',
token_type: 'bearer',
id_token: '<SNIP>',
'not-before-policy': 1571719187,
session_state: '<SNIP>',
scope: 'openid'
}
},
hash: 'amplify-cli:abcdef1234567890',
name: 'amplify-cli:user@domain.com',
org: {
guid: '<GUID>',
id: 12345,
name: 'Example Org'
},
orgs: [
{ },
{ }
],
user: {
axwayId: '<SNIP>',
email: '',
firstName: '',
guid: '',
lastName: '',
organization: '',
is2FAEnabled: true
},
sid: '<SNIP>'
}
Legal
This project is open source under the Apache Public License v2 and is developed by
Axway, Inc and the community. Please read the LICENSE
file included
in this distribution for more information.